package java15;

public class Studentt {
	String[] names = new String[30];

	public void addName(String name) {
		for (int i = 0; i < names.length; i++) {
			if (names[i] == null) {
				names[i] = name;
				break;
			}
		}
	}

	public void showname() {
		for (int i = 0; i < names.length; i++) {
			if (names[i] != null) {
				System.out.println(names[i]);
			}
		}
	}

	public boolean eidtname(String oldname, String newname) {
		boolean find = false;
		for (int i = 0; i < names.length; i++) {
			if (names[i].equals(oldname)) {
				names[i] = newname;
				find = true;
			}

		}
		return find;

	}

	public boolean searchname(int start, int end, String name) {
		boolean find = false;
		for (int i = start - 1; i < end; i++) {
			if (names[i].equals(name)) {
				find = true;

			}

		}
		return find;
	}

	public static void main(String[] args) {
		Studentt sa = new Studentt();
		sa.addName("zhangsan");
		sa.addName("lisi");

	}

}
